<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            font-family:'Courier New', Courier, monospace;
            font-size:30px;
        }
        .container{
            width: max-content;
            margin: 0,auto;
            background-color: yellow;
            padding: 20px 100px;
        }
        
    </style>
</head>
<body>
    <div class="container"></div>
    
    <script type="text/javascript">
        var cont=document.querySelector(".container")
        
        var s=""
        for (i = 1; i <= 5; i++) {
		
			for (k = 5; k > i; k--) {
			
                s+="&nbsp"
			}
			for (j = 1; j <= 2*i-1; j++) {
                
                s+='<span style="color:blue">*</span>'
			}
			s+='<br>'
		}
        for (i = 1; i <= 5; i++) {
        for (k = 0; k < i-1; k++) {
            s+="&nbsp"
        }
        for (j = 1; j <= 2*(5-i)+1; j++) {
            
            s+='<span style="color:red">*</span>'
        }
        s+='<br>'
    }

    cont.innerHTML=s
    </script>
   
</body>
</html>